package cn.edu.zafu.bigdata.x.zzzznnn.j;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class NewsCategory {
    public static void createTable() {
        try {
            Connection connection = DBConnection.getConnection();
            String sql = "CREATE TABLE IF NOT EXISTS news_category (" +
                    "id INT AUTO_INCREMENT PRIMARY KEY," +
                    "category_name VARCHAR(255) NOT NULL" +
                    ")";
            PreparedStatement statement = connection.prepareStatement(sql);
            statement.executeUpdate();
            statement.close();
            connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
